The Mail module allows your script to present a native mail compose view, enabling users to send emails with recipients, subject, body, and attachments prefilled. It also provides a way to check whether the device is capable of sending emails.
Mail.isAvailable: booleanReturns true if the device is configured to send emails using the built-in Mail app.
Mail.present(options): Promise<"cancelled" | "sent" | "failed" | "saved">Presents the system mail composer with the provided options. Users can edit the message, then send, cancel, or save it as a draft.
| Name | Type | Required | Description |
|---|---|---|---|
toRecipients |
string[] |
Yes | List of email addresses to include in the To field. |
ccRecipients |
string[] |
No | List of email addresses for the CC (carbon copy) field. |
bccRecipients |
string[] |
No | List of email addresses for the BCC (blind carbon copy) field. |
preferredSendingEmailAddress |
string |
No | If the user has multiple accounts configured, this can specify the preferred sender's email. |
subject |
string |
No | Email subject line. |
body |
string |
No | The content of the email body. |
attachments |
Attachment[] |
No | Array of files to attach to the email. |
Each attachment must include the following fields:
| Property | Type | Required | Description |
|---|---|---|---|
data |
Data |
Yes | The binary content to attach. |
mimeType |
string |
Yes | The MIME type (e.g., "image/png", "application/pdf"). |
fileName |
string |
Yes | Name of the file as it will appear in the email. |
Returns a Promise that resolves to one of the following result strings:
"sent" – The user sent the email."cancelled" – The user cancelled email composition."failed" – Sending failed due to an error (e.g., no email account configured)."saved" – The email was saved as a draft.This method will throw an error if:
Mail.isAvailable is false